package dao.implementations.postgresql.Socio;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import dao.implementations.DBBase;
import dao.interfaces.Socio.IDireccion;

public class DireccionDB extends DBBase implements IDireccion {
	
	public DireccionDB(Connection connection){
		this.conn = connection;
	}
	
	@Override
	public int eliminarDireccionSocio(int rut){
		PreparedStatement pstm = null;
		int result = 0;
		
		String query =  " DELETE FROM direccion "+
						" WHERE rut_socio=? ";
		try{
			pstm = this.conn.prepareStatement(query);
			
			pstm.setInt(1, rut);
			
			result = pstm.executeUpdate();
			pstm.close();
		}
		catch (SQLException ex)
		{
			System.out.println("Error en la clase DireccionDB -> eliminarDireccionSocio -> "+ ex.getMessage());
		}		
		return result;
	}
}
